<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>作用域插槽</title>
</head>
<body>
<div id="app">
    <cpn></cpn>

    <hr>

    <cpn>
        <template v-slot:content="scope">
            <h2>{{ scope.info }}</h2>
        </template>
    </cpn>
</div>

<template id="cpn">
    <h1>这是一个自定义组件</h1>
    <h2>陕西交通职业技术学院欢迎您!</h2>
    <slot name="content" info="abc"></slot>
</template>

<script type="module">
    import {createApp, defineComponent} from "../../../js/vue.esm-browser.js";

    let component = defineComponent(
        {
            template: "#cpn",
        }
    );

    let app = createApp(
        {
            setup() {
                return {}
            }
        }
    );

    app.component("cpn", component)
    app.mount("#app")
</script>
</body>
</html>